package com.javasvip.web.controller;

import com.javasvip.web.service.CodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.javasvip.web.service.UserService;

import java.util.Calendar;

@Controller
public class UserController {
    @Autowired
    UserService UserService;
    @Autowired
    CodeService routeService;

    @RequestMapping("/testweb")
    public String test(Model model){
        System.out.println("-------------");
        Object eee = UserService.findDefaultResumeState("eee", "222");
        System.out.println("-------------");
        System.out.println("------返回-------"+eee);
        model.addAttribute("currentYear", Calendar.getInstance().get(Calendar.YEAR));
        return "login";
    }

    @RequestMapping("/testroute")
    public String testroute(Model model){
        System.out.println("-------------");
        Integer eee = routeService.findDefaultResumeState("eee", "222");
        System.out.println("-------------");
        System.out.println("------返回-------"+eee);
        model.addAttribute("currentYear", Calendar.getInstance().get(Calendar.YEAR));
        return "login";
    }


    @RequestMapping("/")
    public String toLoginPage(Model model){

        model.addAttribute("currentYear", Calendar.getInstance().get(Calendar.YEAR));
        return "login";
    }

    @RequestMapping("/register")
    public String register(Model model){

        model.addAttribute("currentYear", Calendar.getInstance().get(Calendar.YEAR));
        return "register";
    }

    @RequestMapping("/welcome")
    public String welcome(Model model){

        model.addAttribute("currentYear", Calendar.getInstance().get(Calendar.YEAR));
        return "welcome";
    }

}
